PROJECT?=ginDemo
DST?=bin
APP?=ginDemo
VERSION?=0.1.0
COMMIT_ID?=$(shell git rev-parse HEAD)
BUILD_TIME?=$(shell date '+%Y-%m-%d %H:%M:%S')
EXE?=

ifeq ($(OS),Windows_NT)
	EXE = .exe
endif
default: clean build

clean:
	#rm -f ${DST}/${APP} ${DST}/${APP}.exe
	#rm -rf ${DST}/*.exe

build: clean
	go build  \
	-ldflags "-s -w -X '${PROJECT}/common/version.BuildTime=${BUILD_TIME}' \
	-X ${PROJECT}/common/version.CommitID=${COMMIT_ID} \
	-X ${PROJECT}/common/version.Version=${VERSION} \
	-X ${PROJECT}/common/version.Environment=production" \
    	-o ${DST}/translateServer${EXE} ${PROJECT}


build.development: clean
	go build \
	-ldflags "-s -w -X '${PROJECT}/common/version.BuildTime=${BUILD_TIME}' \
	-X ${PROJECT}/common/version.CommitID=${COMMIT_ID} \
	-X ${PROJECT}/common/version.Version=${VERSION} \
	-X ${PROJECT}/common/version.Environment=development" \
    	-o ${DST}/translateServer${EXE} ${PROJECT}

